import { View, Button, Text } from '@tarojs/components'
import { useEffect, useState } from "react"
import { useReady, useReachBottom, usePullDownRefresh } from "@tarojs/taro"
import { observer, inject } from "mobx-react"

import "./find.scss"


export default inject('store')(
  observer(
    ({ store }) => {

      const [page, setPage] = useState(1)

      useEffect(() => {
        // console.log("准备调接口了....", store);
        store.cnode.getList({ page, limit: 10 })
      }, [page])

      useReachBottom(() => {
        setPage(page + 1)
      })

      usePullDownRefresh(() => {
        store.cnode.resetList();
        setPage(1)
      })

      return (
        <View className='index'>
          {
            store.cnode.list.map(item => (
              <View key={item.id} className="row">
                {item.title}
              </View>
            ))
          }
        </View>
      )
    }
  )
)